package com.tbs.easyhomemoneyserver.form

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.Pattern

@ApiModel
class UserCreateForm {
    @ApiModelProperty("用户名")
    @Pattern(regexp = "^[a-zA-Z0-9_]{6,}$", message = "用户名必须包含英文数字且长度>=6")
    var userName: String? = null

    @ApiModelProperty("手机号")
    @Pattern(regexp = "^\\d{11}$", message = "手机号必须是11位数字")
    var phone: String? = null

    @ApiModelProperty("密码")
    @Pattern(
        regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{8,}$", message = "密码长度>=8且必须包含大小写字母和数字"
    )
    var password: String? = null

    @ApiModelProperty("性别，参考性别常量类SexConstants,0男，1女")
    @Min(value = 0, message = "性别必填男女")
    @Max(value = 1, message = "性别必填男女")
    var sex: Byte? = null
}
